import { create } from 'zustand'

interface BearState {
  user: IUser | null | undefined
  setUser: (user: IUser | null | undefined) => void
}

export const useUserStore = create<BearState>((set, get) => ({
  user: null,
  setUser: (user) => {
    if (user) {
      set({ user: user })
      return
    }
    set({ user: null })
  }
}))
